/**
 * Created: 03/24/2010
 */
package org.klarblick.linkbox.model.entities;

import java.util.List;

/**
 * Entity class representing a link.
 * 
 * @author Sebastian Engel <sebastian.engel@klarblick.org>
 * 
 */
public class Link {

	private long id;

	private String name;

	private String description;

	private String address;

	private List<Category> categories;

	/**
	 * Indicates if this link and a given link are equal.
	 * 
	 * @param category the link to test on equality
	 * @return true, if the given object is a {@link Link} and its address is
	 *         equal to the one of this link.
	 */
	@Override
	public boolean equals(Object link) {
		boolean equal = false;
		try {
			Link compLink = (Link) link;
			if (compLink.getAddress().equalsIgnoreCase(address)) {
				equal = true;
			}
		} catch (ClassCastException e) {
			// equal remains false
		}
		return equal;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

}
